// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueLazyload from 'vue-lazyload'
//引入vuex 
import store from "./store"


router.beforeEach((to,from,next)=>{
  console.log(to,from)
  document.title=to.meta.title||"我的项目";
  let islogin=sessionStorage.getItem("islogin")
  console.log(islogin)
  if(to.meta.requireLogin==true&&islogin!="true"){
    next({path:"/login",query:{redirectURL:to.path}})
  }else{
    next()
  }


})



Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading: 'http://img.zcool.cn/community/017ebd58d921baa801219c775b6f3b.gif',
  attempt: 1
})
import goback from "./until/back.js"
Vue.prototype.goback=goback;

import VueAMap from 'vue-amap';
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: '77ab1a8099a55d5f8c58418dfd3163f5',
  plugin: ['AMap.Autocomplete','AMap.Geolocation', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  // 默认高德 sdk 版本为 1.4.4
  v: '1.4.4'
});


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
